using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DreamBuilder.UI.UserControls.DataAccess.Services;
using DreamBuilder.DictionaryAccess;


namespace DreamBuilder.UI.UserControls
{
    /// <summary>
    /// wxc add use adpter 
    /// </summary>
    public interface IChildItem : ITemplate
    {
        event ItemSelectedEventHandler ItemSelected;
        void SetControlID();
        void SetControlAttributes();
        void SetControlValue(GridViewRow gvRow, string controlID, FieldDicInfo fieldDicInfo, DataRow dr);
        void GetControlValue(GridViewRow gvRow, DataRow dr, string controlID, ChildTableItemInfo fieldDicInfo);
    }
    public static class ChildItemFactory
    {
        public static IChildItem Create(ChildArgs childArgs)
        {
            switch (childArgs.CChildTableItemInfo.ItemType)
            {
                case EDITITEMTYPE.TYPE_NumericEdit:
                    return new NumTemplateColumn(childArgs);
                case EDITITEMTYPE.TYPE_StringEdit:
                    return new StringTemplateColumn(childArgs);
                case EDITITEMTYPE.TYPE_ComboBoxBool:
                    return new BoolTemplateColumn(childArgs);
                case EDITITEMTYPE.TYPE_Date:
                    return new DateTemplateColumn(childArgs);
                case EDITITEMTYPE.TYPE_ComboBoxReference:
                    return new CboTemplateColumn(childArgs);
                case EDITITEMTYPE.TYPE_Reference:
                    return new RefTemplateColumn(childArgs);
                case EDITITEMTYPE.TYPE_RefInput:
                    return new RefInputTemplateColumn(childArgs);
                default:
                    return null;
            }
        }
    }
}

